import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter_module/common/base/base_page.dart';
import 'package:flutter_module/style/colors.dart';

/// Create by kyluzoi
/// Date: 2021-08-23
///
/// Description: 合作服务商 标题 组件

class CooperationTitleContainer extends BaseStatelessWidget {
  final String? title;
  final List<Widget>? children;

  final GestureTapCallback? onEditPress; // 编辑点击事件
  final String? editText; // 编辑按钮文本

  const CooperationTitleContainer(
      {Key? key, this.title, this.children, this.editText, this.onEditPress})
      : super(key: key);

  @override
  Widget createView(BuildContext context) {
    return IntrinsicHeight(
      child: Container(
          width: double.infinity,
          color: Colors.white,
          padding: EdgeInsets.only(bottom: 14, top: 8, left: 16, right: 16),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text(
                    title ?? "",
                    style: _titleTextStyle,
                  ),
                  if (editText != null)
                    GestureDetector(
                      onTap: onEditPress,
                      child: Text(editText!,style: TextStyle(color: ThemeColors.blue009CFE,fontSize: 12),),
                    )
                ],
              ),
              SizedBox(
                height: 9,
              ),
              ...?children
            ],
          )),
    );
  }
}

final _titleTextStyle = TextStyle(
    color: ThemeColors.text333, fontSize: 14, fontWeight: FontWeight.bold);
